/*
 * Alvin Baldemeca
 * 
 * TCSS 305 - Spring 2012
 * Tetris Project Part 1
 * 
 * This package contains the pieces needed for the tetris game being developed.
 * The classes are mutable, however there are some defensive copying employed in
 * the code.  The model package all so contains test for the tetris pieces. 
 */

package model;


/**
 * This class represents an O-tetris piece or a square block.
 * The block can move left, right, down and does not rotate.
 * @author Alvin Baldemeca
 * @version 4/19/2012
 */
public class OPiece extends AbstractPiece
{
  
  /**
   * The initial rotation of this SPiece.
   */
  public static final int[][] ROTATION = {{0, 0}, {1, 0}, {0, 1}, {1, 1}};
  
  /**
   * Creates an O-piece with the given (x,y) coordinate. 
   * @param the_x the initial x coordinate
   * @param the_y the initial y coordinate
   */
  public OPiece(final int the_x, final int the_y)
  {
    super(the_x, the_y, ROTATION.clone(), null);
  }
  
  /**
   * Creates a copy of an OPiece.
   * @param the_original the piece to copy
   */
  public OPiece(final OPiece the_original) 
  {
    super(the_original.getX(), the_original.getY(), the_original.getRotation().clone(), null);
  }
  /**
   * Creates an O-piece at (0,0) coordinate.
   */
  public OPiece() 
  {
    super(0, 0, ROTATION.clone(), null);
  }

  
  /**
   * Do nothing method, when an O-piece rotates it has the same orientation
   * as it was before so essentially it doesn't seem to rotate.
   */
  @Override
  public void rotate()
  {
    //Do nothing method see JAVA doc.
  } 
    
  /**
   * Creates a string representation of the tetris piece with its current
   * rotation using [] to represent a block.  
   * @return the shape of the tetris piece and its rotation.
   */
  @Override
  public String toString() 
  { 
    final StringBuilder sb = new StringBuilder();     
    sb.append("[][]\n[][]");
    return sb.toString();
  }



}